<template>
  <div class="device container">
    <index-breadcrumb :breadcrumb-list="breadcrumbList"></index-breadcrumb>
    <!-- <MediumDateShow2
      :operation-list="operationList"
    ></MediumDateShow2> -->

    <Community></Community>
  </div>
</template>

<script>
// import MediumDateShow from "./includes/MediumDateShow";
//import MediumDateShow2 from "./includes/MediumDateShow2";
 import Community from "@/components/Community"

export default {
  name: "MediumDate",
  components: {
   // MediumDateShow2,
     Community
  },
  data() {
    return {
      operationList: [],
      breadcrumbList: [
        {
          title: "媒体日历",
        },
      ],
    };
  },
  created() {
    this.getOperationList();
  },
  activated() {
  },
  methods: {
    getOperationList() {
      this.$store.state.permissionList.some((item) => {
        const [itemName] = item.permission.split(":");
        if (itemName === "medium") {
          item.list.forEach((listItem) => {
            this.operationList.push(listItem.permission.split(":")[1]);
          });
        }
        if (itemName === "mediumOtherProject") {
          this.operationList.push("mediumOtherProject:view");
          item.list.forEach((listItem) => {
            if(listItem.permission === "mediumOtherProject:addMediumOtherProject"){
              this.operationList.push("mediumOtherProject:addMediumOtherProject");
            }
            if(listItem.permission === "mediumOtherProject:delMediumOtherProject"){
              this.operationList.push("mediumOtherProject:delMediumOtherProject");
            }
          });
        }
        if (itemName === "project") {
          this.operationList.push("project:view");
        }
        return false;
      });
    },
  },
  beforeRouteLeave(to, from, next) {
        this.$bus.$emit('clearSearchParams')
        next()
    },
};
</script>

<style lang="sass" scoped></style>
